# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=missionplanner
pkgver=1.3.83
pkgrel=1
groups=('blackarch' 'blackarch-drone')
pkgdesc='A GroundControl Station for Ardupilot.'
arch=('x86_64' 'aarch64')
url='https://firmware.ardupilot.org/Tools/MissionPlanner/'
license=('GPL3')
depends=('mono')
makedepends=('unzip')
options=('!strip')
source=("http://firmware.ardupilot.org/Tools/MissionPlanner/MissionPlanner-$pkgver.zip")
sha512sums=('8adf370b7ae4fd57e6240eb06d4622195b28d45926fa2c7d081fc29af3f0cec840192aa8425a4ff9f53db2145c6fa77635b7fd003065ff71a5747f6e1de80d6a')

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  rm -rf "$pkgdir/usr/share/$pkgname/MissionPlanner-$pkgver.zip"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec mono MissionPlanner.exe "\$@"
#exec mono ArdupilotMegaPlanner10.exe "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

